<!DOCTYPE html>
<html class="root platform-win" lang="zh"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta charset="UTF-8">
  <title>创建作品 - 作者中心 | 火星小说</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link href="http://author.hotread.com/favicon.ico" rel="shortcut icon">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="renderer" content="webkit">
  <link rel="stylesheet" href="/css/normalize.css">
  <link rel="stylesheet" href="/css/common.css">
    <link rel="stylesheet" href="/css/works.css">
</head>
<body>
  <header class="header">
  <div class="container">
    <a class="slogan" href="/">
      <img src="/image/slogan.png" alt="">
    </a>
    <span class="user">
      <a href="{{url('auth/logout')}}">退出登陆</a>
    </span>
  </div>
</header>
  <div class="container">
    <div class="nav">
  <h4>作者中心</h4>
  <ul>

      <li class="item active"><a href="{{url('work')}}">作品列表</a></li>
    <li class="item"><a href="{{url('subscribe')}}">订阅收入</a></li>
    <li class="item"><a href="{{url('reward')}}">打赏收入</a></li>
    <li class="item"><a href="{{url('comments')}}">评论管理</a></li>
    <li class="item"><a href="{{url('authorset')}}">个人设置</a></li>
  </ul>
</div>
    <div class="estWorks fl" id="create">
  <div class="right-header-haveback">
    <p class="hint wryh-font">
      <a href="{{url('work')}}" class="back">作品列表</a>
      <span>创建作品</span>
    </p>
  </div>
  <div class="estWorks-main">

    <div class="works-cover">
      <div class="label">作品封面</div>

      <div class="cover">

        <tbody>
                <tr>
                    <td height="101" align="center">
                        <div id="localImag" >
                             <img  id="preview" src="" width="100" height="100" style="display: block;border: ;" />
                        </div>
                    </td>
                </tr>
                <tr>
                    <td align="center" style="padding-top:10px;">

                    <form method="post" action="" name="textfile" enctype="multipart/form-data">
                    {!!csrf_field()!!}
                       <input type="file" name="cover_img" id="doc" multiple="multiple" style="width:150px;" onchange="javascript:setImagePreview();"> 
                    </td>
                </tr>
            </tbody>
      </div>
      <span class="mag">封面尺寸为450*590<br>格式为jpg、png、bmp</span>
    </div>
    <div class="works-name">
      <div class="label must">作品名称</div>
      <div class="all-input-box bookname wryh-font" data-placeholder="18字以内，作品创建后不能更改">
        <input maxlength="18" type="text" name="title">
      </div>
    </div>
    <div class="works-chan">
      <div class="label must">所属频道</div>
      <ul class="charge-list">
        <input type="radio" name="gender" value="1"  checked /> 男生频道
        <input type="radio" name="gender" value="0" /> 女生频道

      </ul>
    </div>
    <div class="works-type">
      <div class="label must">作品类型</div>
      <ul class="charge-list">
        <input type="radio" name="type" value="现代都市" /> 现代都市
        <input type="radio" name="type" value="悬疑灵异" /> 悬疑灵异
        <input type="radio" name="type" value="玄幻仙侠" /> 玄幻仙侠
        <input type="radio" name="type" value="历史军事" /> 历史军事
      </ul>
    </div>
    <div class="works-intro">
      <div class="label">作品简介</div>

      <textarea class="intro fl all-input-box" data-placeholder="字数需控制在20至50+0字之间" name = 'desc'></textarea>

      <span class="num fr">当前字数：0</span>
    </div>
    <div class="works-est">
      <div class="label"></div>
      <input type="submit" class="btn" value="创建书籍">
    </div>
    </form>
  </div>
</div>
  </div>

</body>
<script type="text/javascript">
            //下面用于图片上传预览功能
            function setImagePreview(avalue) {
            //input
                var docObj = document.getElementById("doc");
//img
                var imgObjPreview = document.getElementById("preview");
                //div
                var divs = document.getElementById("localImag");
                if (docObj.files && docObj.files[0]) {
                    //火狐下，直接设img属性
                    imgObjPreview.style.display = 'block';
                    imgObjPreview.style.width = '100px';
                    imgObjPreview.style.height = '100px';
                    //imgObjPreview.src = docObj.files[0].getAsDataURL();
                    //火狐7以上版本不能用上面的getAsDataURL()方式获取，需要一下方式
                   imgObjPreview.src = window.URL.createObjectURL(docObj.files[0]);
                } else {
                    //IE下，使用滤镜
                    docObj.select();
                    var imgSrc = document.selection.createRange().text;
                    var localImagId = document.getElementById("localImag");
                    //必须设置初始大小
                    localImagId.style.width = "100px";
                    localImagId.style.height = "200px";
                    //图片异常的捕捉，防止用户修改后缀来伪造图片
                    try {
                        localImagId.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale)";
                        localImagId.filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgSrc;
                    } catch(e) {
                        alert("您上传的图片格式不正确，请重新选择!");
                        return false;
                    }
                    imgObjPreview.style.display = 'none';
                    document.selection.empty();
                }
                return true;
            }
        </script>
</html>
